home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / test / test_charmapcodec.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  2KB  |  54 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.4)
  3.  
  4. ''' Python character mapping codec test
  5.  
  6. This uses the test codec in testcodec.py and thus also tests the
  7. encodings package lookup scheme.
  8.  
  9. Written by Marc-Andre Lemburg (mal@lemburg.com).
  10.  
  11. (c) Copyright 2000 Guido van Rossum.
  12.  
  13. '''
  14. import test.test_support as test
  15. import unittest
  16. codecname = 'test.testcodec'
  17.  
  18. class CharmapCodecTest(unittest.TestCase):
  19.     
  20.     def test_constructorx(self):
  21.         self.assertEquals(unicode('abc', codecname), u'abc')
  22.         self.assertEquals(unicode('xdef', codecname), u'abcdef')
  23.         self.assertEquals(unicode('defx', codecname), u'defabc')
  24.         self.assertEquals(unicode('dxf', codecname), u'dabcf')
  25.         self.assertEquals(unicode('dxfx', codecname), u'dabcfabc')
  26.  
  27.     
  28.     def test_encodex(self):
  29.         self.assertEquals(u'abc'.encode(codecname), 'abc')
  30.         self.assertEquals(u'xdef'.encode(codecname), 'abcdef')
  31.         self.assertEquals(u'defx'.encode(codecname), 'defabc')
  32.         self.assertEquals(u'dxf'.encode(codecname), 'dabcf')
  33.         self.assertEquals(u'dxfx'.encode(codecname), 'dabcfabc')
  34.  
  35.     
  36.     def test_constructory(self):
  37.         self.assertEquals(unicode('ydef', codecname), u'def')
  38.         self.assertEquals(unicode('defy', codecname), u'def')
  39.         self.assertEquals(unicode('dyf', codecname), u'df')
  40.         self.assertEquals(unicode('dyfy', codecname), u'df')
  41.  
  42.     
  43.     def test_maptoundefined(self):
  44.         self.assertRaises(UnicodeError, unicode, 'abc\x01', codecname)
  45.  
  46.  
  47.  
  48. def test_main():
  49.     test.test_support.run_unittest(CharmapCodecTest)
  50.  
  51. if __name__ == '__main__':
  52.     test_main()
  53.  
  54.